package com.zut.dao;

import com.zut.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserDao {
    @Insert("insert into user (user_id,user_name,user_url,user_grant) " +
            "values(#{id},#{name},#{url},#{grant})")
    int insert(User user);

    @Results(id = "groupWithUser",
            value = {
                    @Result(property = "id", column = "user_id", id = true),
                    @Result(property = "name", column = "user_name"),
                    @Result(property = "url", column = "user_url"),
                    @Result(property = "grant", column = "user_grant"),
            })
    @Select("select * from user where user_id = #{id}")
    User selectOneUser(String id);


    @Select("select user_grant from user")
    List<String> selectAllToken();
}
